package com.hengpeng.itfin.persist.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.hengpeng.common.persist.AbstractDao;
import com.hengpeng.common.scheduling.entity.SystemJob;
import com.hengpeng.common.scheduling.entity.SystemJob.SystemJobState;
import com.hengpeng.itfin.persist.SystemJobDao;

/**
 * <pre>
 * TODO 系统作业持久层实现
 * </pre>
 * @author pengfangliang
 * @version 1.0, 2010-9-19
 */
@Repository
public class SystemJobDaoImpl extends AbstractDao<SystemJob> implements SystemJobDao
{

	@Override
	public SystemJob findByClassName(String className)
	{
		List<SystemJob> list = super.findAllByNamedQuery("sysjob.findByClassName", className);
		if (list != null && list.size() > 0)
			return list.get(0);
		else
			return null;
	}

	@Override
	public int resetAllJob()
	{
		return super.exeNamedQuery("sysjob.resetAll", SystemJobState.WAITING, SystemJobState.RUNING);
	}

}
